//
//  SLChargeRecommandViewController.m
//  SoccerLottery
//
//  Created by chuanshuangzhang on 15/12/25.
//  Copyright © 2015年 chuanshuangzhang. All rights reserved.
//

#import "SLChargeRecommandViewController.h"

@interface SLChargeRecommandViewController ()

@property (nonatomic,strong) UILabel *coinLabel;

@end

@implementation SLChargeRecommandViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setTitle:@"心水推介" back:YES];
    self.midView.frame = CGRectMake(0, self.topView.bottom, App_Frame_Width, 93);
    [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:self.timeLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.midView attribute:NSLayoutAttributeBottom multiplier:2.0/4.0 constant:0]];
    [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:self.titleLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.midView attribute:NSLayoutAttributeBottom multiplier:1.0/4.0 constant:0]];
    self.webView.frame = CGRectMake(0, self.midView.bottom, App_Frame_Width,self.view.height-self.midView.bottom);
    
    _coinLabel = [[UILabel alloc]init];
    _coinLabel.text = [NSString stringWithFormat:@"花费：%@金币",self.feedModel.price];
    _coinLabel.font = [UIFont fontWithName:@"Arial" size:14];
    _coinLabel.textColor = [UIColor redColor];
    [self.midView addSubview:_coinLabel];
    [_coinLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:_coinLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.midView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:5]];
    [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:_coinLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.midView attribute:NSLayoutAttributeBottom multiplier:3.0/4.0 constant:0]];
    
    if(self.feedModel.score.length >0 && [self.feedModel.status integerValue] == 0)
    {
        UIView *lineView = [[UIView alloc]init];
        lineView.backgroundColor = [UIColor redColor];
        [self.midView addSubview:lineView];
        [lineView setTranslatesAutoresizingMaskIntoConstraints:NO];
        [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_coinLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:40]];
        [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:_coinLabel attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
        [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:_coinLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]];
        [self.midView addConstraint:[NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:_coinLabel attribute:NSLayoutAttributeHeight multiplier:0.0 constant:1]];
    }
}


@end
